#ifndef _UI_H
#define _UI_H

class ConfigProcessor;

class UI
    {
  public:
    UI () : fd(0), fd_count(0), time_separator(":") {}

    const char *label;

    virtual bool activate()=0;
    virtual bool active()=0;

    virtual ConfigProcessor * init_processor () { return 0; }
    // The second processor is optional if the init_ one can read everything.
    virtual ConfigProcessor * processor () { return 0; }

    // mcp-sent notifications
    virtual void changedPlaytime () {}
    virtual void updatedMediaInfo () {}
    virtual void event (Event event) {}
    virtual void event (Event event, EventData *event_data) {}

    // main loop integration
    int *fd;
    int fd_count;

    virtual void process_input (int fd) {}
    virtual void process_output (int fd) {}
    virtual void fd_exception (int fd) {}

    virtual bool output_pending () { return false; }
    virtual bool timer_wanted () { return false; }

    virtual void timer () {}
    virtual void post_event_cleanup() {}

/*  TODO  method for requesting only the information we need
    int some_update_flag_thingy;

    proposed update flags:
    PLAYLIST_POSITION
    PLAYLIST
    PLAYLIST_INFO
    SONG_POSITION
    SONG_INFO
    PLAYING_STATUS
*/

  public:
     // time display helpers
     enum TimeDisplay
        {
        TIME, TIME_REVERSE,
        OVERALL_TIME, OVERALL_TIME_REVERSE
        };
    const char *time_separator;
    void time_split(unsigned int time_ms, int *hours, int *minutes,
                                          int *seconds, int *milliseconds);
    int time_str(char *str, unsigned int time_ms, bool *hours_check=0,
                            const char *prefix="");
    int playtime_str(char *str, UI::TimeDisplay display, bool *hours_check);
    };

#endif  // _UI_H
